package com.igoal.utils;

/**
 * Convert tools
 * @author Tri Nguyen
 * @version 1.0
 */
public class ConvertUtils {
	
	public static int toInt(String sValue, int nIfNull){
		try{
			return Integer.parseInt(sValue);
		}catch (NumberFormatException numberFormatException) {
			return nIfNull;
		}
	}
	
	public static long toLong(String sValue, long nIfNull){
		try{
			return Long.parseLong(sValue);
		}catch (NumberFormatException numberFormatException) {
			return nIfNull;
		}
	}

	public static long toLong(String sValue, long nIfNull, int radix){
		try{
			return Long.parseLong(sValue, radix);
		}catch (NumberFormatException numberFormatException) {
			return nIfNull;
		}
	}
}
